package com.aeoj.clientmanagement.domain.userscore;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户积分表
 * @TableName aeoj_user_score
 */
@TableName(value ="aeoj_user_score")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserScore {
    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 积分
     */
    private Long score;

    /**
     * 宣言
     */
    private String description;

    /**
     * 段位
     */
    private String rankName;

    /**
     * 对战总场数
     */
    private Integer totalMatches;

    /**
     * 赢场数
     */
    private Integer winMatches;

    /**
     * 输场数
     */
    private Integer loseMatches;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 删除标记：0未删除，1已删除
     */
    private Integer deleted;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserScore other = (UserScore) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getScore() == null ? other.getScore() == null : this.getScore().equals(other.getScore()))
            && (this.getRankName() == null ? other.getRankName() == null : this.getRankName().equals(other.getRankName()))
            && (this.getTotalMatches() == null ? other.getTotalMatches() == null : this.getTotalMatches().equals(other.getTotalMatches()))
            && (this.getWinMatches() == null ? other.getWinMatches() == null : this.getWinMatches().equals(other.getWinMatches()))
            && (this.getLoseMatches() == null ? other.getLoseMatches() == null : this.getLoseMatches().equals(other.getLoseMatches()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getScore() == null) ? 0 : getScore().hashCode());
        result = prime * result + ((getRankName() == null) ? 0 : getRankName().hashCode());
        result = prime * result + ((getTotalMatches() == null) ? 0 : getTotalMatches().hashCode());
        result = prime * result + ((getWinMatches() == null) ? 0 : getWinMatches().hashCode());
        result = prime * result + ((getLoseMatches() == null) ? 0 : getLoseMatches().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", score=").append(score);
        sb.append(", ran=").append(rankName);
        sb.append(", totalMatches=").append(totalMatches);
        sb.append(", winMatches=").append(winMatches);
        sb.append(", loseMatches=").append(loseMatches);
        sb.append(", createTime=").append(createTime);
        sb.append(", deleted=").append(deleted);
        sb.append("]");
        return sb.toString();
    }
}